package {{package}}

{{#imports}}import {{import}}
{{/imports}}
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
{{#useResponseEntity}}
import org.springframework.http.ResponseEntity
{{/useResponseEntity}}
import org.springframework.web.context.request.NativeWebRequest
{{#appendRequestToHandler}}
import org.springframework.http.server.reactive.ServerHttpRequest
{{/appendRequestToHandler}}
{{#reactive}}
import kotlinx.coroutines.flow.Flow
{{/reactive}}

import java.util.Optional

{{#operations}}
/**
 * A delegate to be called by the {@link {{classname}}Controller}}.
 * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class.
 */
{{>generatedAnnotation}}

interface {{classname}}Delegate {

    fun getRequest(): Optional<NativeWebRequest> = Optional.empty()
{{#operation}}

    /**
     * @see {{classname}}#{{operationId}}
     */
    {{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}{{#isBodyParam}}Flow<{{{baseType}}}>{{/isBodyParam}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{/isArray}}{{/reactive}}{{^-last}},
        {{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}},
        {{/hasParams}}{{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}}{{/includeHttpRequestContext}}): {{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}{{>returnTypes}}{{#useResponseEntity}}>{{/useResponseEntity}}{{^skipDefaultDelegateInterface}} {
        {{>methodBody}}{{! prevent indent}}
    }{{/skipDefaultDelegateInterface}}

{{/operation}}
}
{{/operations}}
